home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / doordr40.zip / EDITTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1990-06-21  |  5KB  |  145 lines

  1. {$V-}
  2. uses doordriv,cfgeditr,crt,ddscott; {Uses unit CFGEDITR for the template procedures}
  3.  
  4.  
  5. var
  6.  name,alias,secret_word,quest,alive,weapon,armour,shield:string;
  7.  money,hits:word;
  8.  
  9.             { ^^^^^ The data for our sample player }
  10.  
  11.  
  12. {$F+}           {Far call is now being turned on for the Alt Key Enablement}
  13. procedure Config_editor;
  14. const
  15.  UserEditScreen: templatedef =
  16.                   (Header: 'Demo of the Configurable Editor';
  17.                    Headercolor: green;
  18.                    Titles: (('Name','Alias','Secret Word',
  19.                              'Hits','Money','Quest',
  20.                              '','','',
  21.                              '','','',
  22.                              '','','',
  23.                              '','','',
  24.                              '',''),
  25.                             ('Alive','Weapon','Armour',
  26.                              'Shield','','',
  27.                              '','','',
  28.                              '','','',
  29.                              '', '','','','','','',''));
  30.                    DataLength: ((27,27,27,254,254,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  31.                                 (1,15,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  32.                    Data: (('','','','','','','','','','','','','','','','','','','',''),
  33.                           ('','','','','','','','','','','','','','','','','','','',''));
  34.                    Databyte:    ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  35.                                  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  36.                    Dataint:     ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  37.                                  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  38.                    Datalongint: ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  39.                                  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  40.                    Dataword:    ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
  41.                                  (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
  42.                    Startx: 1;
  43.                    Starty: 3;
  44.                    Normalfore: 4; Inversefore: 15; Inverseback: 2; Titlefore: cyan);
  45.  
  46. procedure dataToTemplate(var template: templatedef);
  47. begin;
  48.  with Template do begin;                  {This is where you transfer     }
  49.   data[1,1]:=name;                        {the users data to the template.}
  50.   data[1,2]:=alias;
  51.   data[1,3]:=secret_word;
  52.   dataword[1,4]:=hits;
  53.   dataword[1,5]:=money;
  54.   data[1,6]:=quest;
  55.   data[2,1]:=alive;
  56.   data[2,2]:=weapon;
  57.   data[2,3]:=armour;
  58.   data[2,4]:=shield;
  59.  end;
  60. end;
  61.  
  62. procedure TemplateToData(var template: templatedef);
  63. begin;
  64.  with Template do begin;                  {This is where you transfer    }
  65.   name:=data[1,1];                        {New, and changed data from the}
  66.   alias:=data[1,2];                       {Template to the user data     }
  67.   secret_Word:=data[1,3];
  68.   hits:=dataword[1,4];
  69.   money:=dataword[1,5];
  70.   quest:=data[1,6];
  71.   alive:=data[2,1];
  72.   weapon:=data[2,2];
  73.   armour:=data[2,3];
  74.   shield:=data[2,4];
  75.  end;
  76. end;
  77.  
  78. var
  79.  s,s2: string;
  80.  a,b: integer;
  81.  moresave: boolean;
  82.  blah: word;
  83.  chainout: char;
  84. begin;
  85.  repeat;
  86.   DataToTemplate(UserEditScreen);              {Transfering data to template}
  87.  
  88.  
  89.   DoEntry(UserEditScreen,chainout);      {Allows you to modify the current}
  90.                                          {Data in the template}
  91.  
  92.   TemplateTodata(UserEditScreen);        {Transfering template to data}
  93.  until (chainout=#45);                   {Repeat until ALT-X is encountered}
  94. end;
  95. {$F-}                                    {Far Call is now being turned off}
  96.  
  97. procedure MakeSampleData;                {Things would be kind of boring}
  98. begin;                                   {without our sample user}
  99.  name:='Derrick Parkhurst';
  100.  alias:='Sir Lancalot';
  101.  secret_word:='BRAVE';
  102.  Hits:=150;
  103.  money:=1000;
  104.  quest:='To Find The Holy Grail';
  105.  Alive:='Y';
  106.  weapon:='Excalibor';
  107.  armour:='Enchanted Mail';
  108.  shield:='Enchanted Shield';
  109. end;
  110.  
  111. var
  112.  s : string;
  113. begin;
  114.  INITDOORDRIVER('doordriv.ctl');          {DoorDriver must be initialized}
  115.  
  116.  
  117.  Proc_Ptr_ar[5]:=@Config_editor;          {Telling DoorDriver where the}
  118.                                           {procedure is and that the }
  119.                                           {the alt key you want is the 5th }
  120.                                           {letter in the alphabet "E"}
  121.  
  122.  
  123.                                           {Go on with our normal door business}
  124.  MakeSampleData;
  125.  swriteln('Right now, assume this program is a normal door. The following');
  126.  swriteln('prompt would represent the normal main menu of your door. Pressing');
  127.  swriteln('ALT-E (on the sysop side only) will pop up the configurable editor');
  128.  swriteln('for this door. (again, on the sysop side only). The user will be');
  129.  swriteln('paused while the sysop is editing');
  130.  repeat;
  131.   set_foreground(green);
  132.   swriteln('');
  133.   swrite('Command (?=Help,Q=Quit) ? ');
  134.   set_foreground(white);
  135.   sread(s);
  136.   set_foreground(default_fore);
  137.   s:=stu(s);
  138.   if s='?' then begin;
  139.    set_foreground(cyan);
  140.    swriteln('Since this is a test only, we have no help!');
  141.    swriteln('just press ALT-E to bring up the sysop side configurable editor');
  142.    set_foreground(default_fore);
  143.   end;
  144.  until s='Q';
  145. end.